const path=require('path')
const VueLoaderPlugin = require('vue-loader/lib/plugin');
//只要是插件，一定要放到plugins节点中去
const htmlWebpackPlugin = require('html-webpack-plugin')
module.exports={
    entry: path.join(__dirname, './src/main.js'),
    output: {
        //输出文件的相关配置
        path: path.join(__dirname, './dist'),
        filename: 'bundle.js'
    },   
    plugins:[
        new htmlWebpackPlugin({
            template: path.join(__dirname, './src/index.html'),  //指定模板页面，将来会根据指定的页面路径，去生成内存中的页面
            filename: 'index.html'   //指定生成页面的名称
        }),
        new VueLoaderPlugin()
    ],
    module:{
        rules:[
            {test:/\.vue$/,use:'vue-loader'},//处理vue文件的loader
            {test: /\.css$/, use:['style-loader', 'css-loader']},
            {test: /\.scss$/, use:['style-loader', 'css-loader', 'sass-loader']},
            {test:/\.(ttf|eot|svg|woff|woff2)$/,use:'url-loader'},
            {test:/.\js$/,use:'babel-loader',exclude:/node_modules/},
            {test: /\.(jpg|png|gif|bng)$/, use:'url-loader?limit=50&name=[hash:8]-[name].[ext]'}
        ]  
    },
    resolve:{
        alias:{//修改vue被导入时候的包的路径
            //"vue$":'vue/dist/vue.js'
        }
    }
}